		KRUSKAL-WALLIS (KW) TEST

Michael Lloyd (http://www.hsu.edu/faculty/lloydm/ti/prgmtabl.html)
Henderson State University

VERSION HISTORY
1.0 - December 1997
1.1 - August 2015 - Updated to .8xp file

VARIABLES USED
[A] = data
C = number of columns (groups)
I,J,K = counters
H = test statistic
list thetaS = dimension of [A]. list sizes
list TEMP = pooled data
list thetaG = group identification numbers
list RANK = order, ranks
list thetaR = sums of the ranks
prgmZZRANK
N = grand sample size
R = number of rows

PROGRAM LISTING
Disp "KRUSKAL-WALLIS","DATA IN [A]"
dim([A])\->\\L\\theta\S:\L\\theta\S(1)\->\R:\L\\theta\S(2)\->\C
For(J,1,C)
sum(seq([A](I,J)\!=\0,I,1,R)\->\\L\\theta\S(J)
End
sum(\L\\theta\S)\->\N
0\->\K:N\->\dim(\L\TEMP)
For(J,1,C)
For(I,1,\L\\theta\S(J))
K+1\->\K
[A](I,J)\->\\L\TEMP(K)
J\->\\L\\theta\G(K)
End:End
seq(I,I,1,N)\->\\L\RANK
SortA(\L\TEMP,\L\RANK)
seq(\L\\theta\G(\L\RANK(I)),I,1,N)\->\\L\\theta\G
SortA(\L\RANK)
prgmZZRANK
C\->\dim(\L\\theta\R):Fill(0,\L\\theta\R)
For(I,1,N)
\L\\theta\R(\L\\theta\G(I))+\L\RANK(I)\->\\L\\theta\R(\L\\theta\G(I))
End
(N+1)
12/(NAns)sum((\L\\theta\R)\^2\/\L\\theta\S)-3Ans\->\H
Disp "H=",H
Disp "DF=",C-1
DelVar \L\RANK:DelVar \L\\theta\G:DelVar \L\\theta\R::DelVar \L\\theta\S:DelVar \L\TEMP
